package com.cdh.edu.controller.api;

import com.cdh.edu.service.TeacherService;
import com.cdh.utils.result.Restful;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author by cdh
 * @description:
 * @Date: Created in 16:36 on 2021/2/25
 */
@Api(tags = "讲师")
@RestController
@RequestMapping("api/edu/teacher")
@CrossOrigin
public class ApiTeacherController {

    @Autowired
    private TeacherService teacherService;

    @ApiOperation(value = "所有讲师列表")
    @GetMapping("listAll")
    public Restful listAll(){
        return Restful.ok().data("items",teacherService.list(null)).message("获取讲师列表成功");
    }

    @ApiOperation(value = "获取讲师详情")
    @GetMapping("get/{id}")
    public Restful get(
            @ApiParam(value = "讲师ID",required = true)
            @PathVariable String id
    ){
        return Restful.ok().data(teacherService.selectTeacherInfoById(id));
    }
}
